// 导入request请求工具
import request from '../utils/request'

// 登录
export const login = (data) => {
  return request({
    url: '/user/login',
    method: 'post',
    data
  })
}

// 注册
export const register = (data) => {
  return request({
    url: '/user/register',
    method: 'post',
    data
  })
}

// 获取用户信息
export const getUserInfo = (userId) => {
  return request({
    url: `/user/${userId}`,
    method: 'get'
  })
}

// 登录后获取用户信息
export const getUserInfoAfterLogin = () => {
  return request({
    url: '/user/userInfo',
    method: 'get'
  })
}

// 忘记密码
export const forgotPassword = (data) => {
  return request({
    url: '/user/forgot-password',
    method: 'post',
    data
  })
}

// 根据用户id获取用户信息
export const getUserById = (userId) => {
  return request({
    url: `/user/${userId}`,
    method: 'get'
  })
}